package com.pocket.cloud.payment.service;

import com.pocket.cloud.payment.dao.OrderSettlementMapper;
import com.pocket.cloud.payment.entity.OrderSettlement;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author zhaozhile
 */
@Service
public class OrderSettlementService {

    @Resource
    private OrderSettlementMapper orderSettlementMapper;

    @Transactional
    public boolean save(OrderSettlement orderSettlement){
        int count = orderSettlementMapper.insert(orderSettlement);
        return count == 1;
    }

    public boolean delete(Long id){
        int count = orderSettlementMapper.deleteByPrimaryKey(id);
        return count == 1;
    }

    public boolean update(OrderSettlement orderSettlement){
        int count = orderSettlementMapper.updateByPrimaryKeySelective(orderSettlement);
        return count == 1;
    }

    public OrderSettlement getById(Long id){
        return orderSettlementMapper.selectByPrimaryKey(id).orElse(null);
    }


}
